import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator
from mpl_toolkits.mplot3d import Axes3D

def w2f(kwsk_point,file_name):
    root_path = './point/'
    f = open(root_path + file_name,'w+')
    f.write('.TRANS' + "\r\n")

    x = []
    y = []
    z = []

    for i in range(0, len(kwsk_point)):
        if i == 0 :
            f.write('point[' + str(i) + ']' + ' 345.000000 345.000000 345.000000 345.000000 345.000000 345.000000' + "\r\n")
        else:
            if i > len(kwsk_point):
                break
            else:
                f.write('point[' + str(i) + ']' + ' ' + str(format(kwsk_point[i][0], '.3f')) + ' ' + str(format(kwsk_point[i][1], '.3f')) + ' ' + str(format(kwsk_point[i][2], '.3f')) + ' ' + '-42.041 179.087 5.538'+"\r\n")
                x.append(kwsk_point[i][0])
                y.append(kwsk_point[i][1])
                z.append(kwsk_point[i][2])

    # fg = plt.figure()
    # plt.subplot(2, 1, 1)
    # plt.scatter(x,y)
    #
    # fg2 = plt.figure()
    # ax = Axes3D(fg2)
    # ax.scatter(x,y,z)
    # # ax.set_xlim(-200, 0);
    # # ax.set_ylim(500, 1000);
    # # ax.set_zlim(0, -100);
    # ax.set_xlabel('X')
    # ax.set_ylabel('Y')
    # ax.set_zlabel('Z')
    #
    # # plt.show()

    f.write('.END' + "\r\n")
    f.close()







